<template>
  <div class="amis-scope">
    <div class="amis-routes-wrapper">
      <div class="antd-Page">
        <div class="antd-Page-content">
          <div class="antd-Page-main">
            <div class="antd-Page-header">
              <h2 class="antd-Page-title"><span class="antd-TplField"><span>{{ title }}</span></span></h2>
            </div>
            <div class="antd-Page-body">
              <a-card :bordered="false" v-if="code=='T000010_APPLY_TYPE_ENTERPRISE_REGISTER' || code =='T000010_APPLY_TYPE_ENTERPRISE_UPDATE'">
                <detail-list title="注册信息" :col="2">
                  <detail-list-item term=" 注册类型">{{ detail.enterpriseRegisterType.name }}</detail-list-item>
                  <detail-list-item term="统一社会信用代码">{{ detail.unifiedSocialCreditCode }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="企业名称">{{ detail.enterpriseName }}</detail-list-item>
                  <detail-list-item term="企业成立日期">{{ detail.foundDate }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="企业类型">{{ detail.enterpriseType.name }}</detail-list-item>
                  <detail-list-item term="企业属性">{{ detail.enterpriseProp.name }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="法定代表人">{{ detail.representativeName }}</detail-list-item>
                  <detail-list-item term="联系电话">{{ detail.enterpriseContactPhone }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="经营地址">{{ detail.businessProvince.name }}{{ detail.businessCity.name }}{{ detail.businessCounty.name }}{{ detail.businessAddress }}</detail-list-item>
                  <detail-list-item term="总注册资本（万元）">{{ detail.registeredCapital }}</detail-list-item>
                </detail-list>
                <detail-list :col="1">
                  <detail-list-item term="经营范围">{{ detail.businessScope }}</detail-list-item>
                </detail-list>
                <detail-list :col="1">
                  <detail-list-item term="营业执照">
                    <img :src="detail.businessCertificateImg" style="width: 300px;">
                  </detail-list-item>
                </detail-list>
              </a-card>
              <a-card :bordered="false" v-if="code=='T000010_APPLY_TYPE_EXPERT_REGISTER'">
                <detail-list title="注册信息" :col="1">
                  <detail-list-item term="头像">
                    <img :src="detail.photo" style="width: 100px">
                  </detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="注册类型">专家</detail-list-item>
                  <detail-list-item term="性别">{{ detail.sex }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="姓名">{{ detail.name }}</detail-list-item>
                  <detail-list-item term="出生日期">{{ detail.birthday }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="个人简介">{{ detail.expertIntroduce }}</detail-list-item>
                  <detail-list-item term="专家分类" v-if="detail.types">{{ detail.types.map(item => item.name).join('、') }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="工作单位">{{ detail.workUnit }}</detail-list-item>
                  <detail-list-item term="工作地址" v-if="detail.province">{{ detail.province.provinceName }}{{ detail.city.cityName }}{{ detail.county.countyName }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="个人成就">{{ detail.achievement }}</detail-list-item>
                  <detail-list-item term="详细地址">{{ detail.address }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="身份证号码">{{ detail.idCardNum }}</detail-list-item>
                  <detail-list-item term="专家职称" v-if="detail.expertTitle">{{ detail.expertTitle.title }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="身份证照片">
                    <a-row :gutter="16">
                      <a-col class="gutter-row" :span="6" v-for="(item,index) in detail.idCardImageList" :key="index">
                        <div class="gutter-box">
                          <img :src="item.src" style="width: 300px;">
                        </div>
                      </a-col>
                    </a-row>
                  </detail-list-item>
                  <detail-list-item term="专家职称照片">
                    <a-row :gutter="16">
                      <a-col class="gutter-row" :span="6" v-for="(item,index) in detail.expertTitleImageList"
                             :key="index">
                        <div class="gutter-box">
                          <img :src="item.src" style="width: 300px;">
                        </div>
                      </a-col>
                    </a-row>
                  </detail-list-item>
                </detail-list>
              </a-card>
              <a-card :bordered="false" v-if="code=='T000010_APPLY_TYPE_FARMERS_REGISTER' || code == 'T000010_APPLY_TYPE_FARMERS_UPDATE'">
                <detail-list title="注册信息" :col="2">
                  <detail-list-item term=" 注册类型">{{ detail.enterpriseRegisterType.name }}</detail-list-item>
                  <detail-list-item term="成立日期">{{ detail.foundDate }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="养殖场名称">{{ detail.enterpriseName }}</detail-list-item>
                  <detail-list-item term="负责人身份证号码">{{ detail.unifiedSocialCreditCode }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="法定代表人">{{ detail.representativeName }}</detail-list-item>
                  <detail-list-item term="联系电话">{{ detail.enterpriseContactPhone }}</detail-list-item>
                </detail-list>
                <detail-list :col="2">
                  <detail-list-item term="经营范围"> {{ detail.businessScope }} </detail-list-item>
                  <detail-list-item term="经营地址">{{ detail.businessProvince.name }}{{ detail.businessCity.name }}{{ detail.businessCounty.name }}{{ detail.businessAddress }}</detail-list-item>
                </detail-list>
                <detail-list :col="1">
                  <detail-list-item term="身份证正反照片">
                    <a-row :gutter="16">
                      <a-col class="gutter-row" :span="6" v-for="(item,index) in detail.idCardNumImages" :key="index">
                        <div class="gutter-box">
                          <img :src="item.src" style="width: 300px;">
                        </div>
                      </a-col>
                    </a-row>
                  </detail-list-item>
                </detail-list>
              </a-card>
              <div style="text-align: center">
                <a-button @click="gotoBack">返回</a-button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import DetailList from "@/components/tool/DetailList";
import {backlog} from '@/services/index'

const DetailListItem = DetailList.Item
export default {
  name: "userRegisterAuditDetails",
  components: {DetailList, DetailListItem},
  data() {
    return {
      code: 'T000010_APPLY_TYPE_ENTERPRISE_REGISTER',
      title: '企业注册审核详情',
      labelCol: {span: 4},
      wrapperCol: {span: 14},
      detail: {
        enterpriseRegisterType: {},
        enterpriseType: {},
        enterpriseProp: {}
      }
    }
  },
  created() {
    let id = this.$route.query.id
    this.code = this.$route.query.code
    this.setTitle(this.code)
    this.getData(id, this.code)
  },
  methods: {
    setTitle(code) {
      switch (code) {
        case 'T000010_APPLY_TYPE_ENTERPRISE_REGISTER':
          this.title = '企业注册审核详情';
          break;
        case 'T000010_APPLY_TYPE_EXPERT_REGISTER':
          this.title = '专家注册审核详情'
          break;
        case 'T000010_APPLY_TYPE_FARMERS_REGISTER':
          this.title = '养殖户注册审核详情'
          break;
        case 'T000010_APPLY_TYPE_FARMERS_UPDATE':
          this.title = '养殖户变更审核详情'
          break;
        case 'T000010_APPLY_TYPE_ENTERPRISE_UPDATE':
          this.title = '养殖企业变更审核详情'
          break;
      }
    },
    getData(id, code) {
      let handle = null
      switch (code) {
        case 'T000010_APPLY_TYPE_ENTERPRISE_REGISTER':
          handle = backlog.querySubjectInfoEnterpriseDetail
          break;
        case 'T000010_APPLY_TYPE_EXPERT_REGISTER':
          handle = backlog.querySubjectInfoExpertDetail
          break;
        case 'T000010_APPLY_TYPE_FARMERS_REGISTER':
          handle = backlog.querySubjectInfoEnterpriseDetail
          break;
        default:
          handle = backlog.querySubjectEnterpriseUpdateInfo
          break;
      }
      handle({id: id}).then(res => {
        this.detail = Object.assign({}, this.detail, res.data.data)
      })
    },
    gotoBack() {
      this.$router.go(-1)
    },
  }
}
</script>

<style scoped>

</style>
